package com.wyvoid.forum.dao.hibernate;

import com.wyvoid.forum.dao.IFriendDAO;
import com.wyvoid.forum.domain.Friend;
import com.wyvoid.core.persistent.hibernate.HibernateDAO;
import com.wyvoid.core.persistent.hibernate.HibernatePage;
import com.wyvoid.core.persistent.Pagination;

/**
 * Created by IntelliJ IDEA.
 * User: wangchao
 * Date: 2007-6-29
 * Time: 22:19:36
 * To change this template use File | Settings | File Templates.
 */
public class FriendDAO extends HibernateDAO<Friend> implements IFriendDAO {
    public HibernatePage getFriendsByUserId(long userId, Pagination pagination) {
         String hql="from Friend f where f.uid=?";
        return doQuery(hql,true,pagination,userId);

    }

    public Friend getFriendByFriendUserId(long friendUserId) {
        String hql="from Friend f where f.friendUser.id=?";
        return doQueryFirst(hql,friendUserId);
    }
}
